<template>
  <basic-container>
    <el-table
      :data="data"
      border
      style="width: 100%; margin-top: 20px">
      <el-table-column
        prop="typeName"
        label="模块"
        width="60"
      >
      </el-table-column>
      <el-table-column
        prop="configInfoName"
        label="配置情况"
        width="80"
      >
      </el-table-column>
      <el-table-column
        prop="statusName"
        width="80"
        label="工作状态">
      </el-table-column>
      <el-table-column
        prop="startTime"
        label="当前启动时间">
      </el-table-column>
      <el-table-column
        prop="stopTime"
        label="停止时间">
      </el-table-column>

      <el-table-column
      prop="runningTime"
      label="当次运行时间">
    </el-table-column>
      <el-table-column
        prop="sumRunningTime"
        label="累计运行时间">
      </el-table-column>
    </el-table>
  </basic-container>
</template>

<script>
  import {getList2} from "@/api/device/periview1";
  import {mapGetters} from "vuex";
  import perichart from './perichart.vue'
  export default {
    data() {
      return {
        form: {},
        selectionList: [],
        loading: true,
        query: {},
        option: {
          refreshBtn: false,
          searchShow: false,
          tip: false,
          tree: true,
          border: true,
          index: true,
          selection: true,
          editBtn: true,
          delBtn: false,
          addBtn:false,
          menuWidth: 100,
          columnBtn: false,
          expand: true,
          expandRowKeys:[1],
          idKey:'stage',
          column: [{
            label: '发酵阶段',
            prop: 'stage'
          }, {
            label: '年龄',
            prop: 'sex'
          }]
        },
        data: []
      };
    },
    components: {perichart},
    props: ["periViewRow"],
    computed: {
    },
    created() {
      this.onLoad()
    },
    methods: {
      objectSpanMethod({ row, column, rowIndex, columnIndex }) {
        if (columnIndex === 0) {
          if (rowIndex % 2 === 0) {
            return {
              rowspan: 2,
              colspan: 1
            };
          } else {
            return {
              rowspan: 0,
              colspan: 0
            };
          }
        }
      },

      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
      },
      onLoad(page, params = {}) {
        console.log('onLoad preview1 ')
        getList2({deviceId: this.periViewRow.id}).then(res => {
          var arr = [];
          ;(res.data || []).forEach((item) => {
            arr.push(item)
          })
          this.data = arr;
        });
      }
    }
  };
</script>

<style>
</style>
